package com.ruoyi.campus.service.impl;

import java.util.List;
import java.util.Map;

import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.campus.mapper.MyPriceListMapper;
import com.ruoyi.campus.domain.MyPriceList;
import com.ruoyi.campus.service.IMyPriceListService;

/**
 * 悬赏榜Service业务层处理
 *
 * @author zht
 * @date 2021-10-24
 */
@Service
public class MyPriceListServiceImpl implements IMyPriceListService
{
    @Autowired
    private MyPriceListMapper myPriceListMapper;

    /**
     * 查询悬赏榜
     *
     * @param offerId 悬赏榜主键
     * @return 悬赏榜
     */
    @Override
    public MyPriceList selectMyPriceListByOfferId(String offerId)
    {
        return myPriceListMapper.selectMyPriceListByOfferId(offerId);
    }

    /**
     * 查询悬赏榜列表
     *
     * @param myPriceList 悬赏榜
     * @return 悬赏榜
     */
    @Override
    public List<MyPriceList> selectMyPriceListList(MyPriceList myPriceList)
    {
        return myPriceListMapper.selectMyPriceListList(myPriceList);
    }

    /**
     * 新增悬赏榜
     *
     * @param myPriceList 悬赏榜
     * @return 结果
     */
    @Override
    public int insertMyPriceList(MyPriceList myPriceList)
    {
        myPriceList.setCreateTime(DateUtils.getNowDate());
        return myPriceListMapper.insertMyPriceList(myPriceList);
    }

    /**
     * 修改悬赏榜
     *
     * @param myPriceList 悬赏榜
     * @return 结果
     */
    @Override
    public int updateMyPriceList(MyPriceList myPriceList)
    {
        return myPriceListMapper.updateMyPriceList(myPriceList);
    }

    /**
     * 批量删除悬赏榜
     *
     * @param offerIds 需要删除的悬赏榜主键
     * @return 结果
     */
    @Override
    public int deleteMyPriceListByOfferIds(String[] offerIds)
    {
        return myPriceListMapper.deleteMyPriceListByOfferIds(offerIds);
    }

    /**
     * 删除悬赏榜信息
     *
     * @param offerId 悬赏榜主键
     * @return 结果
     */
    @Override
    public int deleteMyPriceListByOfferId(String offerId)
    {
        return myPriceListMapper.deleteMyPriceListByOfferId(offerId);
    }

    /**
     * 查询要审核的悬赏榜的相关信息
     * @param myPriceList 悬赏榜
     * @return 结果
     */
    @Override
    public List<MyPriceList> selectAuditPriceList(MyPriceList myPriceList) {
        return myPriceListMapper.selectAuditPriceList(myPriceList);
    }

    /**
     * 根据 offerId 查询要审核的悬赏榜的相关信息
     * @param offerId 悬赏榜主键
     * @return 返回结果对象
     */
    @Override
    public MyPriceList selectAuditPriceListByOfferId(String offerId) {
        return myPriceListMapper.selectAuditPriceListByOfferId(offerId);
    }

    /**
     * 根据 offerId 审核通过该悬赏榜
     * @param offerId 悬赏榜主键
     * @return 影响行数
     */
    @Override
    public int pricePassAuditByOfferId(String offerId) {
        return myPriceListMapper.pricePassAuditByOfferId(offerId);
    }

    /**
     * 根据 offerId 确定该悬赏榜违规
     * @param offerId 悬赏榜主键
     * @return 影响行数
     */
    @Override
    public int priceOutAuditByOfferId(String offerId) {
        return myPriceListMapper.priceOutAuditByOfferId(offerId);
    }

    /**
     * 查询悬赏榜列表
     * @param myPriceList 悬赏榜
     * @return 结果
     */
    @Override
    public List<MyPriceList> getPriceList(MyPriceList myPriceList) {
        return myPriceListMapper.getPriceList(myPriceList);
    }

    /**
     * 获取我发布的悬赏榜信息
     * @param iuserId 发布者ID
     * @return 结果
     */
    @Override
    public List<Map<String, Object>> getMyPriceList(String iuserId) {
        return myPriceListMapper.getMyPriceList(iuserId);
    }
}
